package Usb;

public class Main {
    public static void main(String[] args) {
        USB接口 shubiao = new 鼠标();
        USB接口 jianpan = new 键盘();
        shubiao.connect();
        jianpan.connect();
        operate(shubiao);
        operate(jianpan);
        shubiao.unconnect();
        jianpan.unconnect();
    }

    public static void operate(USB接口 a){
        if(a instanceof 鼠标){
            鼠标 b = (鼠标)a;
            b.shubiaodo();
        }else{
            键盘 b = (键盘)a;
            b.jianpando();
        }
    }
}
